<% title "#{@license.name} license - Libraries.io" %>
<% description "A detailed listing of the most popular, recently updated and most watched #{@license.name} licensed packages online" %>
<% content_for :atom, auto_discovery_link_tag(:atom, search_url(licenses: @license.id, sort: 'latest_release_published_at', order: 'desc', format: :atom), title: "Updated #{@license.id} Packages") %>
<% content_for :atom, auto_discovery_link_tag(:atom, search_url(licenses: @license.id, sort: 'created_at', order: 'desc', format: :atom), title: "New #{@license.id} Packages") %>

<div class="row">
  <div class="col-sm-6">
    <h1>
      <%= @license.name %>
      <% if @license.osi_approved? %>
        <small>OSI Approved</small>
      <% end %>
    </h1>
  </div>
  <div class="col-sm-6">
    <br>
    <p>
      <% url = "http://spdx.org/licenses/#{@license.id}" %>
      Website: <%= link_to url, url %>
    </p>
    <p>
      Total Packages: <%= number_with_delimiter Project.license(@license.id).count %>
    </p>
  </div>
</div>

<hr>

<div class="row">
  <div class="col-md-8">
    <div class='row'>
      <% if @popular.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          Popular <%= @license.id %> Packages
          <small class='more'>
            <%= link_to 'See more &raquo;'.html_safe, search_path(licenses: @license.id, sort: 'rank', order: 'desc') %>
          </small>
        </h4>
        <%= render @popular %>
      </div>
      <% end %>

      <% if @created.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          <%= link_to search_url(licenses: @license.id, sort: 'created_at', order: 'desc', format: :atom), class: 'rss' do %>
            <%= fa_icon "rss-square" %>
          <% end %>
          New <%= @license.id %> Packages
          <small class='more'>
            <%= link_to 'See more &raquo;'.html_safe, search_path(licenses: @license.id, sort: 'created_at', order: 'desc') %>
          </small>
        </h4>
        <%= render @created %>
      </div>
      <% end %>

      <% if @updated.any? %>
      <div class='col-sm-6 platform-column'>
        <h4>
          <%= link_to search_url(licenses: @license.id, sort: 'latest_release_published_at', order: 'desc', format: :atom), class: 'rss' do %>
            <%= fa_icon "rss-square" %>
          <% end %>
          Updated <%= @license.id %> Packages
          <small class='more'>
            <%= link_to 'See more &raquo;'.html_safe, search_path(licenses: @license.id, sort: 'latest_release_published_at', order: 'desc') %>
          </small>
        </h4>
        <%= render @updated %>
      </div>
      <% end %>

      <% if @dependend.any? %>
        <div class='col-sm-6 platform-column'>
          <h4>Most Depended upon <%= @license.id %> Packages</h4>
          <%= render @dependend %>
        </div>
      <% end %>
    </div>
  </div>
  <div class="col-md-4">
    <div class="row">
      <% if @languages.many? %>
      <div class='col-md-12 col-sm-4'>
        <h4>
          <%= fa_icon 'code' %>
          Top <%= @license.id %> Languages
        </h4>
        <%= render partial: 'languages/list_language', collection: @languages, as: :language %>
      </div>
      <% end %>

      <% if @platforms.many? %>
      <div class='col-md-12 col-sm-4'>
        <h4>
          <%= fa_icon 'archive' %>
          Top <%= @license.id %> Package Managers
        </h4>
        <%= render partial: 'platforms/list_platform', collection: @platforms, as: :platform %>
      </div>
      <% end %>

      <% if @keywords.many? %>
        <div class='col-md-12 col-sm-4'>
          <h4>
            <%= fa_icon 'gavel' %>
            Top <%= @license.id %> Keywords
          </h4>
          <%= render partial: 'keywords/list_keyword', collection: @keywords, as: :keyword %>
        </div>
      <% end %>
    </div>
  </div>
</div>
